#include<iostream>
using namespace std;
int main()
{
	int a[64]{454771, 329157, 801601, 580793, 755604, 931703, 529875, 361797,604358, 529564, 574776, 821517, 195563, 688516, 223321, 607845,284772, 603562, 543328, 707484, 533688, 380468, 233733, 257995,896582, 670074, 912386, 702393, 722092, 834842, 126346, 606526,376981, 910643, 413754, 945725, 817853, 651778, 350775, 676550,316935, 487808, 939526, 900568, 423326, 298936, 927671, 539773,136326, 717022, 886675, 466684, 436470, 558644, 267231, 902422,743580, 857864, 529622, 320921, 595409, 486860, 951114,558787,
	};
	int x,min= 999999;
	int i=0,n = 64;
	int count = 0;
	while(i<n)
	{
		x = a[i]/100000+a[i]/10000%10+a[i]/1000%10+a[i]/100%10+a[i]/10%10+a[i]%10;
		if(min > x)
		{
			min = x;
		}
		
		i++;
	}
	i=0;
	while(i<n)
	{
		x = (a[i]/100000)+a[i]/10000%10+a[i]/1000%10+a[i]/100%10+a[i]/10%10+a[i]%10;
		if(x==min)
		{
			cout << a[i] <<' '<<i/8<<' '<< i%8;
			break;
		}
		count++;
		i++;
	}
	return 0;
}
